package com.one.controller;


import com.one.bo.IndicatorBo;
import com.one.bo.MenuBo;
import com.one.dto.Result;
import com.one.entity.IndicatorInfoEntity;
import com.one.entity.IndicatorOptionsEntity;
import com.one.entity.SysMenuEntity;
import com.one.service.IndicatorInfoService;
import com.one.service.SemesterInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 指标表 前端控制器
 * </p>
 *
 * @author zwj
 * @since 2021-10-09
 */
@RestController
@RequestMapping("/indicator")
public class IndicatorInfoController {
    private final IndicatorInfoService indicatorInfoService;

    public IndicatorInfoController(IndicatorInfoService indicatorInfoService) {
        this.indicatorInfoService = indicatorInfoService;
    }

    @ApiOperation(value = "条件查询指标", notes = "条件查询指标")
    @PostMapping("/selectIndicator")
    public Result selectIndicator(@RequestBody IndicatorBo indicatorBo) {
        return indicatorInfoService.selectIndicator(indicatorBo);
    }
    @ApiOperation(value = "删除指标", notes = "删除指标")
    @PostMapping("/deleteIndicator")
    public Result deleteIndicator(@RequestBody IndicatorBo indicatorBo) {
        return indicatorInfoService.deleteIndicator(indicatorBo);
    }

    @ApiOperation(value = "添加指标", notes = "添加指标")
    @PostMapping("/addIndicator")
    public Result addIndicator(@RequestBody IndicatorInfoEntity indicatorInfoEntity) {
        return indicatorInfoService.addIndicator(indicatorInfoEntity);
    }
    @ApiOperation(value = "修改指标信息", notes = "修改指标信息")
    @PostMapping("/updateIndicator")
    public Result updateIndicator(@RequestBody IndicatorInfoEntity indicatorInfoEntity) {
        return indicatorInfoService.updateIndicator(indicatorInfoEntity);
    }

    @ApiOperation(value = "查询指标选项", notes = "查询指标选项")
    @PostMapping("/selectIndicatorOptions")
    public Result selectIndicatorOptions(@RequestBody IndicatorBo indicatorBo) {
        return indicatorInfoService.selectIndicatorOptions(indicatorBo);
    }

    @ApiOperation(value = "添加指标选项", notes = "添加指标选项")
    @PostMapping("/addIndicatorOptions")
    public Result addIndicatorOptions(@RequestBody IndicatorOptionsEntity indicatorOptionsEntity) {
        return indicatorInfoService.addIndicatorOptions(indicatorOptionsEntity);
    }

    @ApiOperation(value = "删除指标", notes = "删除指标")
    @PostMapping("/deleteIndicatorOptions")
    public Result deleteIndicatorOptions(@RequestBody IndicatorBo indicatorBo) {
        return indicatorInfoService.deleteIndicatorOptions(indicatorBo);
    }
    @ApiOperation(value = "修改指标选项", notes = "修改指标选项")
    @PostMapping("/updateIndicatorOptions")
    public Result updateIndicatorOptions(@RequestBody IndicatorOptionsEntity indicatorOptionsEntity) {
        return indicatorInfoService.updateIndicatorOptions(indicatorOptionsEntity);
    }

    @ApiOperation(value = "有效指标", notes = "有效指标")
    @GetMapping("/getIndicators")
    public Result getIndicators() {
        return indicatorInfoService.getIndicators();
    }

    @ApiOperation(value = "条件查询指标与选项", notes = "条件查询指标与选项")
    @PostMapping("/selectQuestionnaireIndicatorOptions")
    public Result selectQuestionnaireIndicatorOptions(@RequestBody IndicatorBo indicatorBo) {
        return indicatorInfoService.selectQuestionnaireIndicatorOptions(indicatorBo);
    }
}

